package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 服务订单
 * </p>
 *
 * @author linan
 * @date 2023-05-26
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ServiceOrderPayStatusEnum", description = "支付状态 #{NOT_PAY:未付款;HAS_PAY:已付款;PARTIAL_PAY:部分付款;SETTLE_AFTER_EXHIBITION:会后结算;REFUND_APPLIED:已申请退款;REFUNDING:退款中;HAS_REFUND:已退款;REFUND_REJECT:退款驳回-枚举")
public enum ServiceOrderPayStatusEnum implements BaseEnum {

    /**
     * NOT_PAY="未付款"
     */
    NOT_PAY("未付款"),
    /**
     * HAS_PAY="已付款"
     */
    HAS_PAY("已付款"),
    /**
     * PARTIAL_PAY="部分付款"
     */
    PARTIAL_PAY("部分付款"),
    /**
     * SETTLE_AFTER_EXHIBITION="会后结算"
     */
    SETTLE_AFTER_EXHIBITION("会后结算"),
    /**
     * REFUND_APPLIED="已申请退款"
     */
    REFUND_APPLIED("已申请退款"),
    /**
     * REFUNDING="退款中"
     */
    REFUNDING("退款中"),
    /**
     * HAS_REFUND="已退款"
     */
    HAS_REFUND("已退款"),
    /**
     * REFUND_REJECT="退款驳回"
     */
    REFUND_REJECT("退款驳回"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ServiceOrderPayStatusEnum match(String val, ServiceOrderPayStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ServiceOrderPayStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ServiceOrderPayStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_PAY,HAS_PAY,PARTIAL_PAY,SETTLE_AFTER_EXHIBITION,REFUND_APPLIED,REFUNDING,HAS_REFUND,REFUND_REJECT", example = "NOT_PAY")
    public String getCode() {
        return this.name();
    }

}
